package io;

import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;

public class BufferInputStreamDemo {

    public static void main(String[] args) throws IOException {

        byte[] buffs = "abc".getBytes();

        // buffs存到字节数组中进行缓存
        InputStream in = new ByteArrayInputStream(buffs);
        // 创建一个
        BufferedInputStream bufferedInputStream = new BufferedInputStream(in);
        int len = 0;
        while ((len = bufferedInputStream.read()) != -1 ) {
            System.out.println((char)len);
        }
        bufferedInputStream.close();
        in.close();
    }
}
